class HeapOnly
{
 public:
 void DestroyMe() //This function will call destructor
 {
   delete this;   // Current object will be deleted means destructor
 } 
 private:
 ~HeapOnly(){}	 // destructor only can be call by member function
};

int main()
{
 // HeapOnly obj;  //error will come
 HeapOnly * ptr = new HeapOnly;  // Object created on heap
 ptr->DestroyMe();				// Object deallocated
}




